<?php
import("@.DAO.BaseDAO");

class OrgDAO extends BaseDAO
{
    protected static $instance = null;

    protected function __construct()
    {
    }

    private function __clone()
    {
    }


    public function createOrg($org)
    {
        return $org->add();
    }

    public function updateOrg($org)
    {
        return $org->save();
    }

    public function getOrgById($id)
    {
        return (new OrganizationModel())->find($id);
    }

    public function deleteOrgById($id)
    {
        return (new OrganizationModel())->delete($id);
    }

    public function getOrgListByUserId($userId)
    {
        return (new OrganizationModel())->where('creator_user_id=' . $userId)->select();
    }

    public function getOrgIdListByUserId($userId){
        return (new OrganizationModel())->where('creator_user_id=' . $userId)->getField('id', true);
    }


}

?>